<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->nullable()->comment('姓名');
            $table->string('phone')->unique();
            $table->string('password');
            $table->char('nike_name', '50')->nullable()->comment('微信昵称');
            $table->char('open_id')->nullable()->comment('小程序openID');
            $table->string('avatar')->nullable()->comment('微信头像');
            $table->string('session_key')->nullable()->comment('小程序sessionKey');
            $table->boolean('is_able')->default(true)->comment('是否禁用');
            $table->date('begin_at')->nullable()->comment('开始时间');
            $table->date('end_at')->nullable()->comment('结束时间');
            $table->json('extended_data')->nullable()->comment('扩展数据');
            $table->rememberToken();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
